#include "config.h"
#include "UART.h"
#include "IR.h"
#include "timer0.h"
static void Timer0_Callback_Handler(); 
uint16_t counter=0;

/***************   *****************/
void	UART_config(void)
{
	COMx_InitDefine		COMx_InitStructure;					
	COMx_InitStructure.UART_Mode      = UART_8bit_BRTx;		
	COMx_InitStructure.UART_BRT_Use   = BRT_Timer1;			
	COMx_InitStructure.UART_BaudRate  = 115200ul;			
	COMx_InitStructure.UART_RxEnable  = ENABLE;				
	COMx_InitStructure.BaudRateDouble = DISABLE;			
	COMx_InitStructure.UART_Interrupt = ENABLE;				
	COMx_InitStructure.UART_Priority    = Priority_0;		
	COMx_InitStructure.UART_P_SW      = UART1_SW_P30_P31;	
	UART_Configuration(UART1, &COMx_InitStructure);		

}
void main()
{
 EA=1;	
 P3n_push_pull(Pin7);
 UART_config();
 IRInit();
 timer0_init(125);
 timer0_add_callback(Timer0_Callback_Handler); // 添加回调函数1
 while(1)
 {
	 IR_Printf();
	
 }	 
}	
/***********************/ 
void Timer0_Callback_Handler()
{
 	if(++counter==8000)
    {
    	counter=0;
    	P37=!P37;
    }

}
